package com.kedou.app;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.widget.ProgressBar;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TabHost;

/**
 * 项目主界面 调度页面
 * 
 * @author zhouchao
 * 
 */
public class CenterActivity extends TabActivity implements
		OnCheckedChangeListener {

	private RadioGroup mainTab;
	private TabHost tabhost;
	private Intent mProject;
	private Intent mInvestor;
	private Intent mAttention;
	private Intent mZcbao;
	private Intent mMy;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_center);
		mainTab = (RadioGroup) findViewById(R.id.main_tab);
		mainTab.setOnCheckedChangeListener(this);
		tabhost = getTabHost();
		mProject = new Intent(this, ProjectListActivity.class);
		tabhost.addTab(tabhost
				.newTabSpec("mProject")
				.setIndicator(
						getResources().getString(R.string.tab_title_project),
						getResources().getDrawable(R.drawable.icon_1_n))
				.setContent(mProject));

		mInvestor = new Intent(this, InvestorListActivity.class);
		tabhost.addTab(tabhost
				.newTabSpec("mInvestor")
				.setIndicator(
						getResources().getString(R.string.tab_title_investor),
						getResources().getDrawable(R.drawable.icon_2_n))
				.setContent(mInvestor));

		mAttention = new Intent(this, AttentionActivity.class);
		tabhost.addTab(tabhost
				.newTabSpec("mAttention")
				.setIndicator(
						getResources().getString(R.string.tab_title_attention),
						getResources().getDrawable(R.drawable.icon_3_n))
				.setContent(mAttention));

		mZcbao = new Intent(this, Zcbaoactivity.class);
		tabhost.addTab(tabhost
				.newTabSpec("mZcbao")
				.setIndicator(
						getResources().getString(R.string.tab_title_zcbao),
						getResources().getDrawable(R.drawable.icon_4_n))
				.setContent(mZcbao));

		mMy = new Intent(this, Myactivity.class);
		tabhost.addTab(tabhost
				.newTabSpec("mMy")
				.setIndicator(getResources().getString(R.string.tab_title_my),
						getResources().getDrawable(R.drawable.icon_5_n))
				.setContent(mMy));
	}

	@Override
	public void onCheckedChanged(RadioGroup group, int checkedId) {
		switch (checkedId) {
		case R.id.radio_button0:

			this.tabhost.setCurrentTabByTag("mProject");
			break;
		case R.id.radio_button1:
			this.tabhost.setCurrentTabByTag("mInvestor");
			break;
		case R.id.radio_button2:
			this.tabhost.setCurrentTabByTag("mAttention");
			break;
		case R.id.radio_button3:
			this.tabhost.setCurrentTabByTag("mZcbao");
			break;
		case R.id.radio_button4:
			this.tabhost.setCurrentTabByTag("mMy");
			break;
		}
	}

}
